
import 'package:flutter/material.dart';
import 'package:flutter_bmfmap/BaiduMap/map/bmf_map_view.dart';
import 'package:flutter_bmfmap/BaiduMap/models/bmf_map_options.dart';

import 'package:ymApp/public.dart';
import 'package:ymApp/store/user_provider.dart';
/**
 * 动态页面
 * **/
//class News extends StatefulWidget {
//  @override
//  _NewsState createState() => _NewsState();
//}
//
//class _NewsState extends State<News> {
//  @override
//  Widget build(BuildContext context) {
//    return Scaffold(
//      appBar: AppBar(title: Text('data'),),
//      body: Center(
//        child: Container(
//          child: Consumer<UserProvider>(
//            builder: (context, userPro, child){
//              return Text('data');
//            },
//          ),
//        ),
//      ),
//    );
//  }
//}
class News extends StatelessWidget {

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(
        title: Text("列表测试"),
      ),
      body: Center(
        child:  BMFMapWidget(
          onBMFMapCreated: (controller) {
            onBMFMapCreated(controller);
          },
          mapOptions: BMFMapOptions(
              center: BMFCoordinate(39.917215, 116.380341),
              zoomLevel: 12,
              mapPadding: BMFEdgeInsets(left: 30, top: 0, right: 30, bottom: 0)
          ),
        ),
//        child: Consumer<UserProvider>(
//            builder: (ctx, counterPro, child) {
//              return Text("当前计数:${counterPro.count}", style: TextStyle(fontSize: 20, color: Colors.red),);
//            }
//        ),
      ),
      floatingActionButton: Consumer<UserProvider>(
        builder: (ctx, counterPro, child) {
          return FloatingActionButton(
            child: child,
            onPressed: () {
                counterPro.count++;
//              counterPro.count += 1;
            },
          );
        },
        child: Icon(Icons.add),
      ),
    );
  }
}